/**
 * 
 */
package leetCode;

/**
 * @author zhongfang
 *
 */
public class MinimumFactorization2 {
    public static int smallestFactorization(int a) {
    	if(a<10){
            return a;
        }
        StringBuilder sb=new StringBuilder();
        for(int i=9;i>=2;i--){
            while(a%i==0){
                sb.append(i);
                a/=i;
            }
        }
        
        if(a!=1){
            return 0;
        }
        try {
			return Integer.parseInt(sb.reverse().toString());
		} catch (Exception e) {
			return 0;
		}
    }
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		System.out.println(smallestFactorization(48));
	}

}
